package cloud.simple.service.domain;


import java.io.IOException;
import java.util.List;
import java.util.Properties;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cloud.simple.service.dao.UserDao;
import cloud.simple.service.model.User;



@Service
@Transactional
public class UserService {

	public String key = "null";
	
	@PostConstruct
	void init(){
		try {
			Properties  properties  = PropertiesLoaderUtils.loadAllProperties("bootstrap.properties");
			String value = properties.getProperty("server.port");
			this.key = value;
			System.out.println("key>>>>>>>>>>>>>>"+this.key);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	@Autowired
	private UserDao userMapper;
	
	public List<User> searchAll(){
		List<User> list = userMapper.findAll();
		System.out.println("key============"+this.key);
		return list;
	}
}
